package com.base.service;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.lazyzhao.util.pagination.Pagination;

public class MenuService extends BasicService {

	public MenuService() {
		TABLENAME_MENU_VIEW = "SELECT * FROM Menu;";
	}

	public List findMenus(Connection conn, Map params, int startend)
			throws SQLException {
		int start = 0;
		int end = 0x3b9ac9ff;
		if (startend > 1)
			start = startend;
		return queryMapList(conn, tname("Menu"), params, start, end);
	}

	public Pagination findMenusView(Connection conn, Map params,
			Pagination pagination) throws SQLException {
		return query(conn, TABLENAME_MENU_VIEW, params, pagination);
	}

	public int insertMenus(Connection conn, Map objects) throws SQLException {
		return query.insert(conn, tname("Menu"), objects);
	}

	/*	public int insert() throws SQLException
	 {
	 return query.insert(conn, tname("Menu"), object);
	 }*/

	public int updateMenu(Connection conn, Map<String, Object> objects,
			String... wheres) //transient wheres[]
			throws SQLException {
		return query.update(conn, tname("Menu"), objects, wheres);
	}

	public int updateMenus(Connection conn, List objects, String... wheres) //transient
			throws SQLException {
		return query.update(conn, tname("Menu"), objects, wheres);
	}

	public static final String TABLENAME_SERVICES = "Menu";
	public static final String TABLENAME_APPS = "apps";
	public String TABLENAME_MENU_VIEW;

}
